package ejercicio.practica2;


import java.io.IOException;
import java.math.BigInteger;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author manolo
 */
public class Ack {
    
    /**
     *
     * @param args
     * @throws IOException
     */
    public static void main(String[] args) throws IOException {
         int m,n;
         
         m = Integer.parseInt(args[0]);
         n = Integer.parseInt(args[1]);
         
         System.out.println(Ackermann(m, n));
     }

    /**
     *
     * @param m
     * @param n
     * @return
     */
    public static int Ackermann(int m, int n) {
        if (m == 0) {
            return (n + 1);
        } else if (n == 0) {
            return (Ackermann(m - 1, 1));
        } else {
            return (Ackermann(m - 1, Ackermann(m, n - 1)));
        }
    }

}
